Symmetric Tree
Medium
Question
Given the root of a tree, return whether the tree is symmetric.
Input: root = [1, 2, 2, 3, 4, 4, 3]
Output: True
Input: root = [1, 2, 2, 3, 4, 4, 4]
Output: False
Input: root = [1, 2, 2, 3, None, 3, None]
Output: False
Clarify the problem
What are some questions you'd ask an interviewer?
Understand the problem
Which of these trees are NOT symmetric?
[1]
[5, 3, 3, 7, None, None, 7]
[3, 3, 3, None, 3, 3, None]
[5, 5, 5, 5, None, 5, None]
All test cases pass! 🎉
Time limit exceeded
InputExpected OutputActual Output
Standard OutputScroll down...
Login or signup to save your code.
Uh oh... looks like you don't yet have access.
Not sure what this unlocks? Check out a free pattern section.